<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>成绩录入</title>
	<link rel='stylesheet' href='CSS/decorator1.css'>
</head>

<body>
	<h1>学生成绩&nbsp;<img src="Image/logo.png" class="logo">&nbsp;管理系统</h1>
    <hr>
	
	<form action="managerAscore-do.jsp" method="post" name="addForm" class="regist">
	<h1 class="form-title">成绩录入</h1>
	<p>I would like to receive your fine publication.</p>
	
	<ul>
	<li>
		<label>课程编号：</label>
		<input type="text" name="cid" required>
	</li>
	<li>
		<label>课程名：</label>
		<input type="text" name="cname" required>
	</li>
	<li>
		<label>学号：</label>
		<input type="number" name="sid" required>
	</li>
	<li>
		<label>姓名：</label>
		<input type="text" name="sname" required>
	</li>
	<li>
		<label>平时成绩：</label>
	   <input type="number" name="score1" required>
	</li>
	<li>
		<label>考试成绩：</label>
	   <input type="number" name="score2" required>
	</li>
	<li>
		<input type="submit" onclick="return checkForm()" value="确认录入">
		<input type="reset">
		<a href="javascript: window.history.go(-1)">  [返回上一级]</a>
	</li>
	</ul>
	</form>
	
	<script type="text/javascript">
    function checkForm() {
    	var cid = addForm.cid.value;
    	var cname = addForm.cname.value;
    	var sid = addForm.sid.value;
    	var sname = addForm.sname.value;
        var score1 = addForm.score1.value;
        var score2 = addForm.score2.value;
        //alert(name + pwd + repwd);
        if (score1 == "" || score1 == null) {
            alert("值不能为空！");
            addForm.score1.focus();
            return false;
        } else if (score2 == "" || score2 == null) {
            alert("值不能为空！");
            addForm.score2.focus();
            return false;
        }else if(score1 > 100 || score1 < 0 ){
        	alert("值不合法！");
        	addForm.score1.focus();
        	return false;
        }else if(score2 > 100 || score2 < 0 ){
        	alert("值不合法！");
        	addForm.score2.focus();
        	return false;
        }else if (cid == "" || cid == null) {
            alert("值不能为空！");
            addForm.cid.focus();
            return false;
        }else if (cname == "" || cname == null) {
            alert("值不能为空！");
            addForm.cname.focus();
            return false;
        }else if (sid == "" || sid == null) {
            alert("值不能为空！");
            addForm.sid.focus();
            return false;
        }else if (sname == "" || sname == null) {
            alert("值不能为空！");
            addForm.sname.focus();
            return false;
        }
        alert('正在提交......');
        return true;
    }
	</script>
</body>
</html>